<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>



<section class="background-page">
	<div class="row padding-top">

		<tiles:insertAttribute name="adminmenu" />

		<article class="column custom-main-column">

			<div id="top" class="row collapse">
				<div class="column large-12">

					<s:form action="sendEmail" namespace="/admin" method="post"
						cssClass="custom ng-pristine ng-valid" theme="simple"
						name="myForm">

						<div class="row">
							<div
								class="box-shadow background-white more-margin-bottom clearfix card content-padding">
								<div
									class="large-12 clearfix blue-topper heading-padding card-header">
									<h3 class="inverse no-margin-top no-margin-bottom">
										<span class="semi-bold"><em>Edit the email</em></span>
									</h3>
								</div>
								<div class="column large-4 small-margin-top">
									<p class="gray italic">Send from:</p>
								</div>

								<div class="column large-8 small-margin-top small-margin-bottom">
									<div class="form-row rp_listing_details_category">
										<div class="row category-hybrid">
											<div class="column large-12 category-hybrid-root">
												<div>
													<input type="text" name="sendFrom" id="sendFrom" placeholder="admin@shiplanet.com"/>
												</div>
												<div rel="sendFrom" class="helper required "></div>
											</div>
										</div>


										<div rel="region" class="helper required "></div>
									</div>
								</div>

								<div class="column large-4 small-margin-top">
									<p class="gray italic">Sent To:</p>
								</div>
								<div class="column large-8 small-margin-top small-margin-bottom">
									<div class="form-row rp_listing_details_category">
										<div class="row category-hybrid">
											<div class="column large-12 category-hybrid-root">
												<div>
													<s:textarea name="sendTo" id="sendTo" readonly="readonly"/>
												</div>
												<div rel="sendTo" class="helper required "></div>
											</div>
										</div>
									</div>
								</div>

								<div class="column large-4 small-margin-top">
									<p class="gray italic">Exclude:</p>
								</div>
								<div class="column large-8 small-margin-top small-margin-bottom">
									<div class="form-row rp_listing_details_category">
										<div class="row category-hybrid">
											<div class="column large-12 category-hybrid-root">
												<div>
													<textarea name="exclusionEmailList" id="exclusionEmailList"></textarea>
												</div>
												<div rel="exclusionEmailList" class="helper required "></div>
											</div>
										</div>
									</div>
								</div>

								<div class="column large-4 small-margin-top">
									<p class="gray italic">Subject:</p>
								</div>
								<div class="column large-8 small-margin-top small-margin-bottom">
									<div class="form-row rp_listing_details_category">
										<div class="row category-hybrid">
											<div class="column large-12 category-hybrid-root">
												<div>
													<textarea name="emailSubject" id="emailSubject"
														placeholder="Greeting from Shiplanet!"></textarea>
												</div>
												<div rel="emailSubject" class="helper required "></div>
											</div>
										</div>
									</div>
								</div>

								<div class="column large-4 small-margin-top">
									<p class="gray italic">Content:</p>
								</div>
								<div class="column large-8 small-margin-top small-margin-bottom">
									<div class="form-row rp_listing_details_category">
										<div class="row category-hybrid">
											<div class="column large-12 category-hybrid-root">
												<div>
													<textarea name="emailTemplate" id="emailTemplate"
														placeholder="Dear $name, Welcome to Shiplanet!"></textarea>
												</div>
												<div rel="emailTemplate" class="helper required "></div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>

						<div class="row collapse">
							<button class="small right" id="send" type="submit">
								Send</button>
						</div>

						<s:hidden name="user.region"/>
						<s:hidden name="user.country"/>
						<s:hidden name="user.companyType"/>
						<s:hidden name="user.companySubType"/>
					</s:form>

				</div>
			</div>

		</article>
	</div>
</section>

<script type="text/javascript">
	function changeRegion() {
		with (window.document.myForm) {
			var regions = new Array();

			regions["0"] = [ "--Please select the region--" ];
			regions["Asia"] = [ "China", "Japan", "Singapore" ];
			regions["Europe"] = [ "UK", "France", "German", "Swiss" ];
			var value = region.value;
			country.options.length = 0;
			var option;

			option = new Option("--Please select the country--", "0");
			country.options.add(option);
			for (i = 0; i < regions[value].length; i++) {
				option = new Option(regions[value][i], regions[value][i]);
				country.options.add(option);
			}
		}
	}

	function changeCompanyType() {
		with (document.myForm) {
			var companyTypes = new Array();
			companyTypes["0"] = [ "--Please select the company type--" ];
			companyTypes["Offshore"] = [ "Jack up drilling rig",
					"semi-sub rig", "accommodation barge", "AHTS" ];
			companyTypes["Engineering"] = [ "engineering" ];
			companyTypes["Commercial"] = [ "bulk carrier", "tanker",
					"container vessel" ];
			companyTypes["Agent"] = [ "agent" ];
			companyTypes["Broker"] = [ "broker" ];
			companyTypes["Shipyard"] = [ "shipyard" ];
			companyTypes["ShipRepairingYard"] = [ "ship repairing yard" ];
			companyTypes["FinancialInvestor"] = [ "financial investor" ];

			var value = companyType.value;
			companySubType.options.length = 0;
			var option;

			option = new Option("--Please select the company sub-type--", "0");
			companySubType.options.add(option);

			for (i = 0; i < companyTypes[value].length; i++) {
				option = new Option(companyTypes[value][i],
						companyTypes[value][i]);
				companySubType.options.add(option);
			}
			if (areas.value == "0")
				companySubType.disabled = true;
			else
				companySubType.disabled = false;
		}
	}

	
</script>